package com.qq2008.game.stzb.aspect;

import com.qq2008.game.stzb.service.UserService;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 登陆验证的切面
 */
@Aspect
@Component
public class AuthAspect {
    @Resource
    private UserService userService;

    /**
     * Controller层切点
     */
    @Pointcut("execution (* com.qq2008.game.stzb.controller..*.*(..))")
    public void controllerAspect() {
    }

    /**
     * 注解层切点
     */
    @Pointcut(value = "@annotation(com.qq2008.game.stzb.annotation.AuthPassport)")
    public void annotationAspect() {
    }

    /**
     * 前置通知 用于拦截Controller层记录用户的操作
     *
     * @param joinPoint 切点
     */
    @Before("annotationAspect()")
    public void doBefore(JoinPoint joinPoint) {
//        System.out.println("进入登陆验证拦截器");
    }
}
